﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Web.Page
{
    public partial class BasePage : System.Web.UI.Page
    {
        public readonly string PAGE_INDEX = "_page_index_";


        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Cache.Remove(PAGE_INDEX);
            }
        }

        protected void SavePageIndex(int index)
        {
            Cache.Insert(PAGE_INDEX, index);
        }

        protected int RestorePageIndex()
        {
            object obj = Cache.Get(PAGE_INDEX);
            if ((obj == null))
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
    }
}